package vn.com.pavibook.model.vo;

import java.io.Serializable;
import java.util.Date;

import org.hibernate.validator.constraints.NotEmpty;
import org.hibernate.validator.constraints.Range;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

import vn.com.pavibook.domain.model.AudioBook;

@SuppressWarnings("serial")
public class AudioBookVO implements Serializable {
	private Integer id;
	
	private Integer publisherId;
	
	@NotEmpty(message = "Nhập thông tin")
	private String title;
	
	@NotEmpty(message = "Nhập thông tin")
	private String description;
	
	private String imageUrl;
	
	private String urlAudio;
	
	private Date createdDate;
	
	@Range(min=0,max=99999999,message="Nhập số")
	private double price;
	
	@Range(min=0,max=99999999,message="Nhập số")
	private double discount;

	private Integer active;
	
	private CommonsMultipartFile audioFileUpload;
	
	private CommonsMultipartFile imageFileUpload;
	
	public AudioBookVO() {

	}

	public AudioBookVO(Integer id, String title, String description,
			String urlAudio, String imageUrl, Date createdDate, 
			double price, double discount, Integer active) {
		this.id = id;
		this.title = title;
		this.description = description;
		this.urlAudio = urlAudio;
		this.imageUrl = imageUrl;
		this.createdDate = createdDate;
		this.price = price;
		this.discount = discount;
		this.active = active;
	}

	public AudioBook convertToAudioBook() {
		return new AudioBook(id, publisherId, title, description, urlAudio, imageUrl, createdDate,
				price, discount, active);
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getUrlAudio() {
		return urlAudio;
	}

	public void setUrlAudio(String urlAudio) {
		this.urlAudio = urlAudio;
	}

	public Date getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public double getDiscount() {
		return discount;
	}

	public void setDiscount(double discount) {
		this.discount = discount;
	}

	public CommonsMultipartFile getAudioFileUpload() {
		return audioFileUpload;
	}

	public void setAudioFileUpload(CommonsMultipartFile audioFileUpload) {
		this.audioFileUpload = audioFileUpload;
	}

	public Integer getPublisherId() {
		return publisherId;
	}

	public void setPublisherId(Integer publisherId) {
		this.publisherId = publisherId;
	}

	public String getImageUrl() {
		return imageUrl;
	}

	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}

	public CommonsMultipartFile getImageFileUpload() {
		return imageFileUpload;
	}

	public void setImageFileUpload(CommonsMultipartFile imageFileUpload) {
		this.imageFileUpload = imageFileUpload;
	}

	public Integer getActive() {
		return active;
	}

	public void setActive(Integer active) {
		this.active = active;
	}
}
